<style>
    div.sp_result_area.shadowDown{
        width:auto
    }
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label class="control-label col-xs-3 col-sm-2"><span style="color: red">*</span>&nbsp;{:__('Bin_origin')}:</label>
        <div class="col-xs-3 col-sm-2">
            <select  id="c-bin_origin" data-rule="required" class="form-control selectpicker" name="row[bin_origin]" >
                {if $bin_origin==1 }    <option value="1" selected>自备箱</option> {/if}
                {if $bin_origin==2 }     <option value="2" selected>租赁箱</option>{/if}
            </select>
        </div>
        <label class="control-label col-xs-3 col-sm-2"><span style="color: red">*</span>&nbsp;{:__('还箱日期')}:</label>
        <div class="col-xs-3 col-sm-2">
            <input id="c-returntime" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[returntime]" type="text" value="{:date('Y-m-d H:i:s')}">
        </div>
        <label class="control-label col-xs-3 col-sm-1"><span style="color: red">*</span>&nbsp;{:__('Salesman_id')}:</label>
        <div class="col-xs-3 col-sm-1">
            <input id="c-salesman_id" data-rule="required" data-field="nickname"  data-source="auth.admin/index" class="form-control selectpage" name="row[salesman_id]" type="text" value="">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-6 col-sm-2"><span style="color: red">*</span>&nbsp;{:__('Customer_id')}:</label>
        <div class="col-xs-6 col-sm-2">
            <input id="c-customer_id" data-rule="required" data-params='{"custom[organ_type]":4}' data-field="organ_name" data-source="organization/index" class="form-control selectpage" name="row[customer_id]" type="text" value="">
        </div>
        <div class="col-xs-6 col-sm-1">
            <a href="{:url('organization/add',['organ_type'=>4])}"  class="btn btn-success btn-dialog" title="添加" ><i class="fa fa-plus"></i> 添加</a>
        </div>
        <label class="control-label col-xs-3 col-sm-2"><span style="color: red">*</span>&nbsp;{:__('Return_yard_id')}:</label>
        <div class="col-xs-3 col-sm-2">
            <input id="c-return_yard_id" data-rule="required" data-params='{"custom[organ_type]":1}' data-field="organ_name" data-source="organization/index" class="form-control selectpage" name="row[return_yard_id]" type="text" value="">
        </div>
        <div class="col-xs-6 col-sm-1">
            <a href="{:url('organization/add',['organ_type'=>1])}"  class="btn btn-success btn-dialog" title="添加" ><i class="fa fa-plus"></i> 添加</a>
        </div>
    </div>

    <div class="form-group purchase_number">
        <label class="control-label col-xs-12 col-sm-2"><span style="color: red">*</span>&nbsp;{:__('还箱数量')}:</label>
        <div class="col-xs-6 col-sm-2">
            <input id="c-return_number" data-rule="required" class="form-control" name="row[return_number]" type="number"  >
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('选择箱子')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-choose_bin"  data-multiple="ture"  data-format-item="{bin_sn}&#45;&#45;&#45;&#45;&#45;&#45;{bin_type_name}&#45;&#45;&#45;&#45;&#45;&#45;{bin_native_name}" data-field="bin_sn" data-source="bin/restore_choose_bin" class="form-control selectpage" name="row[choose_bin]" type="text" value="" placeholder="选填">
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">箱子详情</label>
        <div class="col-xs-12 col-sm-8">

            <table class="table fieldlist" data-name="row[multiplejson]" data-template="row[multiplejson]tpl">
                <tr>
                    <td><span style="color: red">*</span>&nbsp;箱号</td>

                    <td><span style="color: red">*</span>&nbsp;还箱堆场</td>
                    <td>进场时间</td>

                    <td>还箱备注</td>

                    <td width="90">{:__('Operate')}</td>
                </tr>
                <tr>
                    <td colspan="5">
                        <a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a>
                        <textarea name="" class="form-control hide" cols="30" rows="5"></textarea>
                    </td>
                </tr>
            </table>
            <script type="text/html" id="row[multiplejson]tpl">
                <tr>
                    <td style="display: none"><input type="text" name="<%=name%>[<%=index%>][rent_id]" class="form-control bin_id"  placeholder="必填"/></td>

                    <td><input type="text" name="<%=name%>[<%=index%>][bin_number]" class="form-control bin_number"  placeholder="必填" disabled/></td>


                    <td>
                        <select  data-rule="required" class="form-control selectpicker return_yard_id" name="<%=name%>[<%=index%>][return_yard_id]">
                            <option ></option>
                            {foreach name="yardList" item="vo"}
                            <option value="{$vo.id}" >{$vo.organ_name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td><input type="text" name="<%=name%>[<%=index%>][entertime]" class="form-control datetimepicker entertime"  placeholder="选填" /></td>
                    <td><input type="text" name="<%=name%>[<%=index%>][bin_remark]" class="form-control"  placeholder="选填" /></td>


                    <td width="90">
                        <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
                        <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
                    </td>
                </tr>
            </script>

        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-remark" class="form-control editor" rows="5" name="row[remark]" cols="50"></textarea>
        </div>
    </div>
    <div class="form-group" style="display: none;">
        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0">
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
        </div>
    </div>
</form>
